<template>
  <ScaleBox>
    <div class="bigScreen">
      <div class="homePage-header">

        <div class="header-title">
          <span class="title-text">{{ headerTitle }}</span>
        </div>
        <timeInfo style="position: absolute;right: 0;top: 0;margin-left: auto;"></timeInfo>
      </div>
      <div class="main-body">
        <div class="main-body-left">
          <div class="main-body-box">
            <div class="main-body-box-title">
              {{ leftTitle }}
            </div>
          </div>
          <div class="module-content">
            <PanelGroup :panelDataList="left1List" class="left-top"></PanelGroup>
            <moduleBox class="left-charts1">
              <template #title>
                <span style="text-align:center">培训类型占比</span>
              </template>
              <LeftPie :dataList="left2List" :title="left2Title"></LeftPie>
            </moduleBox>
            <moduleBox class="left-charts1">
              <template #title>
                <span style="text-align:center">子公司培训合格率</span>
              </template>
              <LeftBar :dataList="left3List"></LeftBar>
            </moduleBox>
          </div>
        </div>
        <div class="main-body-center">
          <div class="main-body-center-top">
            <img class="imgRing" src="../../assets/images/bigScreen/bg-center-ring.png" alt="">
            <div class="main-body-center-1">
              <span class="center-1-title">
                {{ centerTitle }}
              </span>
              <span class="center-1-content">
                {{ centerNum }}
              </span>
            </div>
          </div>
          <div class="main-body-center-bottom">
            <div v-for="(item, index) in jumpToList" :key="index" class="center-bottom-btn">
              <div class="center-bottom-btn-icon">
                <!-- <el-image style="" :src="getImg(item.icon)" /> -->
                <el-image style="" :src="item.icon" />
                <!-- <svg :class="svgClass" aria-hidden="true">
                <use :xlink:href="iconName" />
              </svg> -->
                <!-- <svg-icon icon-class="bigScreen-left1" /> -->
              </div>
              <div class="center-bottom-btn-text">
                {{ item.name }}
              </div>
              <div class="center-bottom-btn-click" @click="jumpTo(item)">
                <span type="primary" size="mini">进入菜单</span>
              </div>
            </div>
          </div>

          <div class="main-body-center-iconLeft">
            <div class="iconLeft-line">
              <img src="../../assets/images/bigScreen/icon-point-line.png" alt="">
            </div>

            <img class="iconLeft-pic" src="../../assets/images/bigScreen/icon-point-line-pic.png" alt="">
          </div>
          <div class="main-body-center-iconRight">

            <img class="iconLeft-pic" src="../../assets/images/bigScreen/icon-point-line-pic.png" alt="">
            <div class="iconLeft-line">
              <img src="../../assets/images/bigScreen/icon-point-line.png" alt="">
            </div>
          </div>


        </div>
        <div class="main-body-right">
          <div class="main-body-box">
            <div class="main-body-box-title">
              {{ rightTitle }}
            </div>
          </div>
          <div class="module-content">
            <PanelGroup class="left-top" :panelDataList="right1List"></PanelGroup>
            <moduleBox class="right-charts1">
              <template #title>
                <span style="text-align:center">考试完成率</span>
              </template>
              <RightBar :dataList="right2List"></RightBar>
            </moduleBox>
            <moduleBox class="left-charts1">
              <template #title>
                <span style="text-align:center">得分区间分布</span>
              </template>
              <RightBar2 :dataList="right3List"></RightBar2>
            </moduleBox>
          </div>
        </div>

      </div>




    </div>
  </ScaleBox>
</template>

<script >
import ScaleBox from "@/components/ScaleBox";
import PanelGroup from './PanelGroup.vue';
import timeInfo from "./timeInfo.vue";
import LeftPie from './charts-left-pie.vue';
import LeftBar from './echarts-left-bar';
import RightBar from './echarts-right-bar';
import RightBar2 from './echarts-right-bar2';
import moduleBox from "./module-box.vue";
import bigScreenServer from '@/api/bigScreen';
// import { getTrainStatistics } from '@/api/bigScreen.ts';
export default {
  components: { ScaleBox, timeInfo, PanelGroup, LeftPie, LeftBar, moduleBox, RightBar, RightBar2 },
  data() {
    return {
      headerTitle: '能源大学堂',
      leftTitle: '培训信息统计',
      rightTitle: '考试信息统计',
      centerTitle: '参与培训总人次(万)',

      left1List: [],
      left2List: [],
      left2Title: '',
      left3List: [],

      right1List: [],
      right2List: [],
      right3List: [],

      reportList: [
      ],

      centerNum: 0,

      jumpToList: [
        {
          name: '培训中心',
          icon: new URL('../../assets/images/bigScreen/icon-pxzx.png', import.meta.url).href,//'../../assets/images/bigScreen/icon-pxzx.png',
          toPath: "/index",
          toPathName: "TrainIndex"
        },
        {
          name: '考试中心',
          icon: new URL('../../assets/images/bigScreen/icon-kszx.png', import.meta.url).href,
          toPath: "/paper/index",
          toPathName: "PaperIndex"
        },
        {
          name: '报名中心',
          icon: new URL('../../assets/images/bigScreen/icon-bmzx.png', import.meta.url).href,//'../../assets/images/bigScreen/icon-bmzx.png',
          toPath: "/apply/index",
          toPathName: "ApplyIndex"
        },
        {
          name: '考试记录',
          icon: new URL('../../assets/images/bigScreen/icon-ksjl.png', import.meta.url).href,//'../../assets/images/bigScreen/icon-ksjl.png',
          toPath: "/record/index",
          toPathName: "RecordIndex"
        },
        {
          name: '通知公告',
          icon: new URL('../../assets/images/bigScreen/icon-tzgg.png', import.meta.url).href,//'../../assets/images/bigScreen/icon-tzgg.png',
          toPath: "/announcement/index",
          toPathName: "AnnouncementIndex"
        },
      ]
    }
  },
  methods: {
    //初始化数据
    init() {
      bigScreenServer.getTrainStatistics().then(res => {
        // console.log("res==", res.response);
        this.left1List = [
          {
            width: 12,
            name: "regist",
            title: "培训数量",
            icon: new URL('../../assets/images/bigScreen/icon-pxsl.png', import.meta.url).href,// new URL(`../../assets/images/bigScreen/bigScreen-left1.png`, import.meta.url).href,
            iconBg: new URL("../../assets/images/bigScreen/bigScreen-left1.png", import.meta.url).href,//"../../assets/images/bigScreen/bigScreen-left1.png",
            color: "#36a3f7",
            colorHover: "#36a3f7",
            text: res.response.trainCount,

          },
          {
            width: 12,
            name: "empty",
            title: "课件数量",
            icon: new URL('../../assets/images/bigScreen/icon-kjsl.png', import.meta.url).href,//'../../assets/images/bigScreen/icon-kjsl.png',
            iconBg: new URL('../../assets/images/bigScreen/bigScreen-left2.png', import.meta.url).href,//"../../assets/images/bigScreen/bigScreen-left2.png",
            color: "#36a3f7",
            colorHover: "#36a3f7",
            text: res.response.courseWareCount,

          },
          {
            width: 12,
            name: "warning",
            title: "分配/完成人数(万)",
            icon: new URL('../../assets/images/bigScreen/icon-fpwcrs.png', import.meta.url).href,//('../../assets/images/bigScreen/icon-fpwcrs.png'),
            iconBg: new URL('../../assets/images/bigScreen/bigScreen-left3.png', import.meta.url).href,//this.getImg("../../assets/images/bigScreen/bigScreen-left3.png"),
            color: "#36a3f7",
            colorHover: "#36a3f7",
            text: res.response.trainTotalCount + '/',// + '/' + res.response.trainFinishCount,
            text2: res.response.trainFinishCount,
          },
          {
            width: 12,
            name: "addNew",
            title: "完成率",
            icon: new URL('../../assets/images/bigScreen/icon-wcl.png', import.meta.url).href,//this.getImg('../../assets/images/bigScreen/icon-wcl.png'),
            iconBg: new URL('../../assets/images/bigScreen/bigScreen-left4.png', import.meta.url).href,//this.getImg("../../assets/images/bigScreen/bigScreen-left4.png"),
            color: "#36a3f7",
            colorHover: "#36a3f7",
            text: res.response.finishRate + '%',

          },
        ];
      }).catch(err => { });

      bigScreenServer.getTrainTypeRate().then(res => {
        let data = res.response;
        this.left2Title = data.total;
        this.left2List = data.list.map(item => {
          return { name: item.trainType, value: item.trainCount }
        })
        // console.log("left2List",this.left2List);
      }).catch(err => { }).finally(() => { });
      bigScreenServer.getSubCompanyTrainPassRate().then(res => {

        let data = res.response.data;
        let xAxis = res.response.xAxis
        // console.log("left3List1",res);
        this.left3List = data.map((item, index) => {

          return { name: xAxis[index], value: item }
        })
        // console.log("left3List",this.left3List);
      }).catch(err => { }).finally(() => { });
      bigScreenServer.getTrainTotalCount().then(res => {
        this.centerNum = res.response;
      }).catch(err => { }).finally(() => { });
      bigScreenServer.getExamStatistics().then(res => {
        let data = res.response;
        console.log("getExamStatistics", data);
        this.right1List = [
          {
            width: 12,
            name: "regist",
            title: "考试数量",
            icon: new URL('../../assets/images/bigScreen/icon-kssl.png', import.meta.url).href,//this.getImg('../../assets/images/bigScreen/icon-kssl.png'),// new URL(`../../assets/images/bigScreen/bigScreen-left1.png`, import.meta.url).href,
            iconBg: new URL('../../assets/images/bigScreen/bigScreen-left1.png', import.meta.url).href,//this.getImg("../../assets/images/bigScreen/bigScreen-left1.png"),
            color: "#36a3f7",
            colorHover: "#36a3f7",
            text: res.response.examCount || 0,

          },
          {
            width: 12,
            name: "empty",
            title: "题库数量",
            icon: new URL('../../assets/images/bigScreen/icon-tksl.png', import.meta.url).href,//this.getImg('../../assets/images/bigScreen/icon-tksl.png'),
            iconBg: new URL('../../assets/images/bigScreen/bigScreen-left2.png', import.meta.url).href,//this.getImg("../../assets/images/bigScreen/bigScreen-left2.png"),
            color: "#36a3f7",
            colorHover: "#36a3f7",
            text: res.response.questionCount || 0,

          },
          {
            width: 12,
            name: "warning",
            title: "分配/完成人数(万)",
            icon: new URL('../../assets/images/bigScreen/icon-fpwcrs.png', import.meta.url).href,//this.getImg('../../assets/images/bigScreen/icon-fpwcrs.png'),
            iconBg: new URL('../../assets/images/bigScreen/bigScreen-left3.png', import.meta.url).href,//this.getImg("../../assets/images/bigScreen/bigScreen-left3.png"),
            color: "#36a3f7",
            colorHover: "#36a3f7",
            text: (res.response.examTotalUserCount || 0) + '/',// + '/' + res.response.trainFinishCount,
            text2: res.response.examFinishUserCount || 0,
          },
          {
            width: 12,
            name: "addNew",
            title: "完成率",
            icon: new URL('../../assets/images/bigScreen/icon-wcl.png', import.meta.url).href,//this.getImg('../../assets/images/bigScreen/icon-wcl.png'),
            iconBg: new URL('../../assets/images/bigScreen/bigScreen-left4.png', import.meta.url).href,//this.getImg("../../assets/images/bigScreen/bigScreen-left4.png"),
            color: "#36a3f7",
            colorHover: "#36a3f7",
            text: res.response.finishRate + '%',

          },
        ];
        this.right2List = data.examFinishRankList.map(item => {

          return { name: item.name, value: item.finishRate }
        })
        this.right3List = data.xaxis.map((item, index) => {
          return { name: item, value: data.yaxis[index] }
        })
      }).catch(err => { }).finally(() => { });
    },
    jumpTo(item) {
      this.$router.push({ path: item.toPath })
    },
    getImg(url) {
      console.log("new URL(url, import.meta.url).href", new URL(url, import.meta.url).href);
      return new URL(url, import.meta.url).href
    },
  },
  mounted() {
    this.init()
  }
}
</script>


<style lang="scss" scoped>
.bigScreen {
  width: 100%;
  height: 100%;
  // min-width: 1500px;
  // min-height: 900px;
  overflow: auto;
  background-image: url("@/assets/images/bigScreen/bg-bigScreen.png");
  background-position: center center;
  background-repeat: no-repeat;
  background-size: 100% 100%;
  display: flex;
  flex-direction: column;

  .homePage-header {
    width: 100%;
    background-image: url("@/assets/images/bigScreen/bg-header.png");
    background-position: center center;
    background-repeat: no-repeat;
    // background-size: 100% 100%;
    // height: 123px;

    background-size: 100% 123%;
    height: 100px;
    position: relative;



    .header-title {
      text-align: center;
      margin: 20px auto;

      .title-text {
        font-family: "微软雅黑 Bold", 微软雅黑, sans-serif;
        font-weight: 700;
        font-style: normal;
        font-size: 36px;
        color: rgb(255, 255, 255);
        word-wrap: break-word;
        text-shadow: 0px 0px 20px rgba(0, 200, 244, 1);
        -webkit-text-shadow: 0px 0px 20px rgba(0, 200, 244, 1);
        -moz-text-shadow: 0px 0px 20px rgba(0, 200, 244, 1);
        text-transform: none;
      }
    }

  }

  .main-body {
    display: flex;
    justify-content: space-between;
    flex: 1;
    width: 100%;
    height: 0;
    padding: 0 20px 20px 20px;
    gap: 30px;

    .main-body-box {
      height: 40px;
      display: flex;
      align-items: center;
      justify-content: center;

      .main-body-box-title {
        font-family: "微软雅黑 Bold", 微软雅黑, sans-serif;
        font-weight: 700;
        font-style: normal;
        font-size: 18px;
        color: rgb(47, 213, 255);
      }
    }

    .main-body-left {
      width: 31%;
      background-image: url("@/assets/images/bigScreen/bg-main-left.png");
      background-position: center center;
      background-repeat: no-repeat;
      background-size: 100% 100%;
      display: flex;
      flex-direction: column;
    }

    .module-content {
      flex: 1;
      display: flex;
      flex-direction: column;

      .left-top {
        height: 30%;
      }

      .left-charts1 {
        height: 35%;
      }

      .right-charts1 {
        height: 38%;
        padding: 0 20px;
      }
    }

    .main-body-center {
      flex: 1;
      display: flex;
      flex-direction: column;
      position: relative;

      .main-body-center-top {
        position: relative;
        height: 70%;
        margin-top: 30px;
        background-image: url("@/assets/images/bigScreen/bg-center.png");
        background-position: center center;
        background-repeat: no-repeat;
        // background-size: 100% 100%;

        display: flex;
        justify-content: center;
        align-items: center;

        .imgRing {
          position: absolute;
          top: 25px;
          -webkit-transform: rotate (360deg);
          animation: rotation 20s linear infinite;
          -moz-animation: rotation 20s linear infinite;
          -webkit-animation: rotation 20s linear infinite;
          -o-animation: rotation 20s linear infinite;
        }

        @-webkit-keyframes rotation {
          from {
            -webkit-transform: rotate(0deg);
          }

          to {
            -webkit-transform: rotate(360deg);
          }
        }


      }

      .main-body-center-bottom {
        flex: 1;
        display: flex;
        justify-content: space-evenly;
        gap: 10px;
        align-items: center;

        .center-bottom-btn {
          width: 117px;
          height: 152px;
          display: flex;
          flex-direction: column;
          align-items: center;
          justify-content: space-evenly;
          background-image: url("@/assets/images/bigScreen/bg-center-bottom.png");
          background-position: center center;
          background-repeat: no-repeat;
          background-size: 100% 100%;

          .center-bottom-btn-icon {}

          .center-bottom-btn-text {
            font-weight: 700;
            font-style: normal;
            font-size: 20px;
            color: #FFFFFF;
          }

          .center-bottom-btn-click {
            padding: 3px;
            font-family: 'Arial', sans-serif;
            font-weight: 400;
            font-style: normal;
            font-size: 10px;
            color: #66F2FF;
            border: 1px solid #66F2FF;
            border-radius: 10px;
            cursor: pointer;
          }

        }
      }

      .main-body-center-1 {
        display: flex;
        align-items: center;
        flex-direction: column;
        margin-bottom: 50px;

        .center-1-title {
          font-family: 'Arial Negreta', 'Arial Normal', 'Arial', sans-serif;
          font-weight: 700;
          font-style: normal;
          font-size: 36px;
          color: #FFFFFF;
        }

        .center-1-content {
          font-family: 'DIN ', 'DIN', sans-serif;
          font-weight: 700;
          font-style: normal;
          font-size: 100px;
          color: #0CF4D1;
        }

      }

      .main-body-center-2 {}
    }

    .main-body-right {
      width: 31%;
      background-image: url("@/assets/images/bigScreen/bg-main-left.png");
      background-position: center center;
      background-repeat: no-repeat;
      background-size: 100% 100%;
      display: flex;
      flex-direction: column;
    }

  }

  .main-body-center-iconLeft {
    display: flex;
    align-items: center;
    position: absolute;
    top: 200px;
    left: -60px;

    .iconLeft-line {
      width: 67px;
      height: 67px;
      transform: rotate(90deg);
      display: flex;
      align-items: center;
      justify-content: center;
    }

    .iconLeft-pic {}
  }

  .main-body-center-iconRight {
    display: flex;
    align-items: center;
    position: absolute;
    top: 200px;
    right: -60px;

    .iconLeft-line {
      width: 67px;
      height: 67px;
      transform: rotate(270deg);
      display: flex;
      align-items: center;
      justify-content: center;
    }

    .iconLeft-pic {}
  }
}
</style>
